package org.gp.demo.timer.Trigger;

import java.util.Date;

import org.gp.demo.timer.job.SimpleJob;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.SimpleTrigger;
import org.quartz.impl.StdSchedulerFactory;

public class SimpleTriggerDemo {
	public static void main(String[] args) {
		try {
			JobDetail jobDetail = new JobDetail("job_1", "jgroup1",
					SimpleJob.class);
			SimpleTrigger simpleTrgget = new SimpleTrigger("trgget_1",
					"tgroup1");
			simpleTrgget.setStartTime(new Date());
			simpleTrgget.setRepeatInterval(2000);
			simpleTrgget.setRepeatCount(10);
			SchedulerFactory schedulerFactory = new StdSchedulerFactory();

			Scheduler scheduler = schedulerFactory.getScheduler();
			scheduler.scheduleJob(jobDetail, simpleTrgget);
			scheduler.start();
		} catch (SchedulerException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
}
